<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Players extends CI_Controller {
	
	function __construct(){
		parent::__construct();
		$this->load->model('player','PLAYER');
	}
	function index(){
		$players = $this->PLAYER->getPlayers();
		$data['players'] = $players;
		$this->load->view("header");
		$this->load->view("players",$data);
		$this->load->view("footer");
	}	
	
	function defend($playerId, $talonid){
		echo json_encode($this->PLAYER->defend($playerId, $talonid));
	}
	
	function attack($playerId, $talonid){
		echo json_encode($this->PLAYER->attack($playerId, $talonid));
	}
	
	function getPlayers(){
		print_r(json_encode($this->PLAYER->getPlayers()));
	}
	function replenishePlayer($playerId){
		echo json_encode($this->PLAYER->replenishePlayer($playerId));
	}
	
	function acceptCards($playerId){
		echo json_encode($this->PLAYER->acceptCards($playerId));
	}
}
?>